#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
	//FILE* P = fopen("wenjian", "r+");
	////fseek(P, 0, SEEK_END);
	//fputs("what can i say?\n", P);
	//char T[] = "KKKKKKKKKKKKKKKKK";
	//fseek(P, 0, SEEK_END);
	//fputs("hehehe\n", P);
	//rewind(P);
	//int i = ftell(P);
	//printf("%d\n", i);
	//fclose(P);

	//FILE* L = fopen("wenjian", "r+");
	//char H = 'v';
	//if (fputc(H, L) == EOF) {
	//	perror("Error writing to file");
	//}
	//fclose(L);

	//FILE* B = fopen("wenjian", "r+");
	////;
	//fgets(T, 10, B);
	//fclose(B);

	//FILE* c = fopen("wenjian", "r+");
	//T[8] = fgetc(c);
	//fclose(c);

	////fseek(P, 0, SEEK_END);
	//printf("%s", T);
	//return 0;

	//wenjiankaobei
	FILE* P = fopen("wenjian", "r");
	FILE* H = fopen("text-3-22-copy", "w");

	if (P == NULL || H == NULL) {
		perror("Error opening file");
		return 1;
	}

	int c;
	while ((c = fgetc(P)) != EOF) {
		fputc(c, H);
	}

	fclose(P);
	fclose(H);
	return 0;
}